package com.atguigu.admin.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;

import java.util.Arrays;
import java.util.List;

/**
 * @author 杨林
 * @create 2023-08-29 14:05 星期二
 * description:
 */
@Controller
public class TableController {

    /**
     * 
     * @param a 不带请求参数或者参数类型不对， 400；Bad Request  一般都是浏览器参数传递问题
     * @return
     */
    @GetMapping("/basic_table")
    public String basicTable(@RequestParam("a") Integer a){
        int i = 10 / 0;
        
        return "table/basic_table";
    }
    
    @GetMapping("/dynamic_table")
    public String dynamicTable(Model model){
        //表格的内容动态遍历的
//        List<User> users = Arrays.asList(new User("zhangsan", "123456"),
//                new User("lisi", "123456"),
//                new User("haha", "aaa"),
//                new User("wangwu", "bbb"));
//        model.addAttribute("users",users);
        return "table/dynamic_table";
    }
    
    @GetMapping("/responsive_table")
    public String responsiveTable(){
        
        return "table/responsive_table";
    }
    
    @GetMapping("/editable_table")
    public String editableTable(){
        
        return "table/editable_table";
    }
}
